package com.algrithom.tree.avltree;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * AVL树的节点类
 *
 * @param <T> 泛型
 * @author think
 * @version 1.0.0
 */
@Setter
@Getter
@NoArgsConstructor
public class AvlNode<T> {
    
    T element;
    
    AvlNode<T> left;
    
    AvlNode<T> right;
    
    /**
     * 记录高度
     */
    int height;
    
    /**
     * 构造器
     *
     * @param theElement 元素
     */
    public AvlNode(T theElement){
        this(theElement,null,null);
        element = theElement;
    }
    
    public AvlNode(T theElement,AvlNode<T> left,AvlNode<T> right){
        this.element = theElement;
        this.left = left;
        this.right = right;
        this.height = 0;
    }
}
